package edu.ynu.se.xiecheng.achitectureclass.entity;

import edu.ynu.se.xiecheng.achitectureclass.common.entity.LogicEntity;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.List;
@Entity
@Getter
@Setter
@Where(clause = "is_deleted = 0")
public class ShopItem extends LogicEntity {
    @Column
    private String shopItemId;
    @Column
    private String shopItemName;
    @Column
    private String type;
    @Column
    private BigDecimal shopItemPrice;
    @Column
    private boolean onSale;
    @OneToOne
    private Item item;
    @OneToMany(mappedBy = "shopItem")
    private List<Order> orderList;
    @ManyToOne
    private Order order;
    @ManyToOne
    private Business business;
    @ManyToOne
    private Shop shop;

    // 其他属性和方法

    public List<Order> getOrderList() {
        return orderList;
    }
    public ShopItem() {
        this.onSale = false; // 默认不上架
    }

    public void setBusiness(Business business) {
        this.business = business;//设置商家对象
    }

    public void setItem(Item item) {
        this.item = item;//设置商品对象
    }

    public void setOnSale(boolean onSale) {
        this.onSale = false;//设置是否上架
    }
}
